package com.ghh.controllor;

import com.ghh.comfig.RabbitMQConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/data")
public class UserControllor {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @PutMapping("/sync")
    public String sync(){

        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_NAME,"user.search",1);

        return "数据已经开始同步";
    }
}
